//
//  UINavigationBar+CustomBar.m
//  FYP
//
//  Created by fyp on 13-9-3.
//  Copyright (c) 2013年 fyp. All rights reserved.
//

#import "UINavigationBar+CustomBar.h"

@implementation UINavigationBar (CustomBar)

-(void) customizeBar:(NSString *)backgroundImageName
{
    //set navigation bar background
    UIImage *image = [UIImage imageNamed:backgroundImageName];
    if([self respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)] )
    {
        //iOS 5 new UINavigationBar custom background
        [self setBackgroundImage:image forBarMetrics: 0]; //UIBarMetricsDefault];
    }
    else{
        UIImageView *imgView = [[UIImageView alloc] initWithImage:image];
        [imgView setUserInteractionEnabled:NO];
        
        [self insertSubview:imgView atIndex:0];
    }
}

@end
